nanopyx.core.transform.interpolation_nearest_neighbor
class
Interpolator:
def
magnify(self, magnification) -> numpy.ndarray:
Magnify an image by a factor of magnification
Parameters
- magnification: magnification factor
Returns
magnified image
def
magnify_xy(self, magnification_y, magnification_x) -> numpy.ndarray:
Magnify an image by a factor of magnification
Parameters
- magnification: magnification factor
Returns
magnified image
def
scale_xy(self, scaling_y, scaling_x) -> numpy.ndarray:
Scale an image by a factor. Equivalent to magnify_xy but takes floats as inputs and mantains image shape.
Parameters
- scaling_y: scale factor in y
- scaling_x: scale factor in x
Returns
scaled image
def
shift(self, dx, dy) -> numpy.ndarray:
Shift an image by (dx, dy) using interpolation
Parameters
- dx: shift along x-axis
- dy: shift along y-axis
Returns
shifted image
def
rotate(self, angle, cx=-1.0, cy=-1.0) -> numpy.ndarray:
Rotate an image by angle radians around (cx,cy) using interpolation
Parameters
- angle: rotation angle in radians, positive angles are counter clockwise
- cx: x coordinate of the center of rotation, defaults to image center if negative
- cy: y coordinate of the center of rotation, defaults to image center if negative
def
polar(self, scale='linear') -> numpy.ndarray:
Transforms an image into its polar coordinate equivalent with origin at the center of the image
Parameters
- scale: scaling done during conversion, if 'log' performs log-polar transformation
Returns
(theta,r) image array
def
cartesian(self, x_shape, y_shape, scale='linear') -> numpy.ndarray:
Transforms an image into its cartesian coordinate equivalent. Assumes image shape is (theta,r) and the origin is at the center of the cartesian image
Parameters
- x_shape: width of original image
- y_shape: height of original image
- scale: scaling performed during transition to polar coordinates, if 'log' assumes the image was a log-polar image
Returns
(y,x) image array